{% extends 'Base.html' %}
{% load staticfiles %}
{% block main %}
    <form class="layui-form layui-form-pane" method="post">
        <input style="display: none" type="number" name="article_id" value="{{ article_id }}">
        <div class="layui-form-item" pane>
            <span class="layui-form-label" style="text-align: center">文章标题</span>
            <div class="layui-input-block">
                <input type="text" placeholder="请输入标题......" name="article_title" lay-verify="required"
                       class="layui-input"
                       value="{{ title }}" autocomplete="off">
            </div>
        </div>
        {#       md编辑器#}
        <div class="layui-form-item" id="bbd-mdedit" style="z-index:1">
            <textarea style="display:none;">{{ content |safe }}</textarea>
        </div>
        {#        信息提示框#}
        <div id="message" class="alert alert-warning alert-dismissable" style="display: none">
        </div>
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md4">
                <div class="layui-form-item" pane ng-controller="categories">
                    <span class="layui-form-label">分类</span>
                    <div class="layui-input-block">
                        <select name="article_category" id="article_category2">
                            {% if category %}
                                <option id="bbd-edit-{{ category.0 }}"
                                        value="{{ category.0 }}">{{ category.1 }}</option>
                            {% else %}
                                <option value="">搜索或选择文章分类</option>
                            {% endif %}
                            {% for category in categories %}
                                {{ category.id }}
                                <option value={{ category.id }}>{{ category.assortment }}</option>
                            {% endfor %}
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-col-md7">
                <div class="layui-form-item" pane>
                    <span class="layui-form-label">标签</span>
                    <div class="layui-input-block">
                        <input class="layui-input" type="text" name="article_tag"
                               placeholder="例如：Python,Django,Flask,BootStrap" autocomplete="off" lay-verify="required"
                               value="{{ tag }}">
                    </div>
                </div>
            </div>
            <div class="layui-col-md1">
                <div class="layui-form-item">
                    <div>
                        <button class="layui-btn" lay-submit lay-filter="article_edit" id="edit_submit">立即提交
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <div style="display: none" id="edit_message">wwqwqw</div>

    <link rel="stylesheet" href="/static/editor.md-master/css/editormd.min.css"/>
    <script src="{% static 'js/jquery.slim.min.js' %}"></script>
    <script src="/static/editor.md-master/editormd.min.js"></script>
    {#编辑器js文件#}
    <script type="text/javascript" src="/static/js/article_edit.js"></script>
{% endblock %}